package cn.edu.zjut.dao;
import org.hibernate.Query;
import org.hibernate.SessionFactory;
import org.hibernate.Session;
import org.hibernate.cfg.Configuration;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import java.util.List;

/**
 * @author XiaoFeng
 * @version 1.0
 * @Description
 * Create by 2021/10/27 19:06
 */

public class ItemDAO extends BaseHibernateDAO{
    private static final Log log = LogFactory.getLog(ItemDAO.class);
    public List findByHql(String hql) {
        log.debug("find item instance by HQL");
        try{
            String queryString = hql;
            Query queryObject = getSession().createQuery(queryString);
            return queryObject.list();
        }catch (RuntimeException re){
            log.error("find by hql failed",re);
            throw re;
        }
    }
}
